package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	
	import frame.ResFrame;
	import frame.UIFrame;
	import frame.UIListUIFrame;
	
	import loaderData.LoaderSys;
	
	[SWF (frameRate="30", width="1024", height="750")]
	
	public class UIEdit extends Sprite
	{
		[Embed(source = "../bin-debug/data/xml/chat.xml",mimeType = "application/octet-stream")]
		private var theClass:Class;
		
		public function UIEdit()
		{
			if (stage) Init();
			else addEventListener(Event.ADDED_TO_STAGE, Init);
		}
		
		/**
		 * 
		 * @param event
		 * 
		 */
		protected function Init(event:Event = null):void
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
			LoaderSys.inst.load(["data/ui/UIPane.swf"], null, Success);

		}

		
		private function Success():void
		{
			addChild(new UIFrame());
			addChild(new UIListUIFrame());
			addChild(new ResFrame());
		}
		
		public function Create(xmlList:XMLList):void
		{
			for (var i:int = 0; i < xmlList.length(); i++) 
			{
				var xml:XML = xmlList[i];

				trace(xml.@text,xml.@Name, xml.@ClassName);
				var list:XMLList = xml.children() as XMLList;
				Create(list);
			}
		}
		
	}
}